<%@ page language="java" import="net.sf.json.JSONObject" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="org.apache.commons.fileupload.FileItem" %>
<%@ page import="org.apache.commons.lang.StringUtils" %>
<%@ page import="java.net.URLDecoder" %>
<%@ page import="up7.biz.PathBuilder" %>
<%@ page import="up7.biz.WebSafe" %>
<%@ page import="up7.biz.up7_biz_event" %>
<%@ page import="up7.model.FileInf" %>
<%@ page import="up7.utils.*" %>
<%@ page import="com.google.gson.Gson" %>
<%@ page import="java.io.ByteArrayOutputStream" %>
<%
	out.clear();
	
	HttpRequest form = new HttpRequest(pageContext);
	FileItem file = form.getFile("file");
	
	if(file == null)
	{
		JSONObject res = new JSONObject();
		res.put("detail", "file data empty");
		out.write(res.toString());
		return;
	}
		
	ByteArrayOutputStream ostm = StreamTool.toStream(file);
    String s = URLDecoder.decode(ostm.toString(),"UTF-8");
	file.delete();

	Gson g = new Gson();
	FileInf fsv = g.fromJson(s, FileInf.class);

	fsv.saveScheme();
	
	JSONObject res = new JSONObject();
	res.put("state", true);
	out.write(res.toString());
%>